#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int maxArea(vector<int>& height) {
        int n = height.size() - 1;
        int left = 0;
        int right = n;
        int vmax = 0;


        while (left < right)
        {
            int w = right - left;
            int h = min(height[left], height[right]);
            int v = w * h;
            vmax = max(v, vmax);

            if (height[left] > height[right])
            {
                right--;
            }
            else
            {
                left++;
            }

        }
        return vmax;
    }
};
/* int h2=max(height[left],height[right]);
            int w2=right-left;
            int v2=h2*w2;
            if(v2<v1)
            {
                vmax=v1;
                break;
            }
            else
            {
                vmax=v2;

            }
            if(height[right]>height[left])
            {
                left++;

            }
            else
            {
                right--;
            }*/